package com.xr.maintain.controller;

import com.xr.maintain.entity.ResponseBo;
import com.xr.maintain.service.MaintainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * Created on 2021/6/4
 * @author qiao
 * @Desc:
 *
 */

@RestController
@RequestMapping("/maintain")
public class MaintainController {


    @Autowired
    private MaintainService maintainService;


    /**
     * @Description:
     * 根据传递的参数选择对那个表进行数据迁移
     *
     * @param type
     * @return com.xr.common.entity.basic.ResponseBo
     */
    @GetMapping("/maintain")
    public ResponseBo maintain(String type) {
        return maintainService.maintainByType(type);
    }

    /**
     * @Description:
     *  迁移所有的数据
     *
     * @return com.xr.common.entity.basic.ResponseBo
     */
    @GetMapping("/maintainAll")
    public ResponseBo company() {
        return maintainService.maintainAll();
    }

    /**
     * @Description:
     * 使用多线程的方式迁移所有的数据
     *
     * @return com.xr.common.entity.basic.ResponseBo
     */
    @GetMapping("/maintainAllThread")
    public ResponseBo companyThread() {
        return maintainService.maintainAllThread();

    }

}
